﻿<ad:DocumentContent x:Class="Poet.ChildWindow"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" 
             d:DesignHeight="300" 
             d:DesignWidth="300" 
                    
             xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit" 
             xmlns:local="clr-namespace:Poet" 
                    PreviewDragOver="DocumentContent_PreviewDragOver" MouseDoubleClick="DocumentContent_MouseDoubleClick">
          
    <ad:DocumentContent.CommandBindings>
        <CommandBinding Command="Save" Executed="Save_Executed"/>
        <CommandBinding Command="SaveAs" Executed="SaveAs_Executed"/>
        <CommandBinding Command="Close" Executed="Close_Executed"/>
        <CommandBinding Command="local:ChildWindow.GoTo" Executed="GoTo_Executed"/>
        <CommandBinding Command="local:ChildWindow.PageSetup" Executed="PageSetupExecuted"/>
        <CommandBinding Command="local:ChildWindow.Font" Executed="FontExecuted"/>
        <CommandBinding Command="PrintPreview" Executed="PrintPreviewOnExecute"/>
        <CommandBinding Command="Print" Executed="PrintOnExecute"/>
    </ad:DocumentContent.CommandBindings>

    <ad:DocumentContent.InputBindings>
        <KeyBinding Key="Escape" Command="Close"/>
        <KeyBinding Key="X" Modifiers="Alt" Command="Close"/>
        <KeyBinding Key="G" Modifiers="Ctrl" Command="local:ChildWindow.GoTo"/>
    </ad:DocumentContent.InputBindings>

    <Grid PreviewMouseDown="Grid_PreviewMouseDown">

        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <avalonedit:TextEditor Name="_textEditor" ShowLineNumbers="True" PreviewMouseWheel="TextEditorPreviewMouseWheel">
            <avalonedit:TextEditor.ContextMenu>
                <ContextMenu>

                        <MenuItem Header="_Undo" Command="Undo" Name="item1">
                            <MenuItem.Icon>
                                <Image Source="Images/Undo.png" Height="16"/>
                            </MenuItem.Icon>
                        </MenuItem>

                        <MenuItem Header="_Redo" Command="Redo" Name="item2">
                            <MenuItem.Icon>
                                <Image Source="Images/Redo.png" Height="16"/>
                            </MenuItem.Icon>
                        </MenuItem>

                        <Separator/>

                        <MenuItem Header="Cu_t" Command="Cut" Name="item3">
                            <MenuItem.Icon>
                                <Image Source="Images/Cut.png" Height="16"/>
                            </MenuItem.Icon>
                        </MenuItem>

                        <MenuItem Header="_Copy" Command="Copy" Name="item4">
                            <MenuItem.Icon>
                                <Image Source="Images/Copy.png" Height="16"></Image>
                            </MenuItem.Icon>
                        </MenuItem>

                        <MenuItem Header="_Paste" Command="Paste" Name="item5">
                            <MenuItem.Icon>
                                <Image Source="Images/Paste.png" Height="16"></Image>
                            </MenuItem.Icon>
                        </MenuItem>

                        <MenuItem Header="_Delete" Command="Delete" Name="item6">
                            <MenuItem.Icon>
                                <Image Source="Images/Delete.png" Height="16"></Image>
                            </MenuItem.Icon>
                        </MenuItem>

                        <Separator/>
                        <MenuItem Header="Select _All" Command="SelectAll" Name="item7"/>
                    
                    <Separator/>
                    
                    <MenuItem Header="More...">
   
                        <MenuItem Command="Find">
                            <MenuItem.Icon>
                                <Image Source="Images/FindHS.png" Height="16"/>
                            </MenuItem.Icon>
                        </MenuItem>

                        <MenuItem Command="Search">
                            <MenuItem.Icon>
                                <Image Source="Images/FindNextHS.png" Height="16"/>
                            </MenuItem.Icon>
                        </MenuItem>

                        <MenuItem Command="Replace">
                            <MenuItem.Icon>
                                <Image Source="Images/Replace_16x16.png" Height="16"/>
                            </MenuItem.Icon>
                        </MenuItem>

                        <MenuItem Header="_Go To Line" Command="local:ChildWindow.GoTo" InputGestureText="Ctrl+G">
                            <MenuItem.Icon>
                                <Image Source="Images/GoTo_16x16.png" Height="16"/>
                            </MenuItem.Icon>
                        </MenuItem>
                    </MenuItem>

                </ContextMenu>
            </avalonedit:TextEditor.ContextMenu>
        </avalonedit:TextEditor>
    </Grid>
    
</ad:DocumentContent>